﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.VisualBasic;
using Coldairarrow.Util;
using Castle.Core;
using System.Net.NetworkInformation;
using OfficeOpenXml.Style;
using Org.BouncyCastle.Math;
using System.Drawing;
using Coldairarrow.Business.Interface;
using Org.BouncyCastle.Utilities;
using System.Globalization;

namespace Coldairarrow.Entity.Interface
{
    /// <summary>
    /// 销售报告
    /// </summary>
    /// 
    public class YDOrdersDTO
    {
        /// <summary>
        /// 订单列表
        /// </summary>
        public List<Orders> orders { get; set; }
        /// <summary>
        /// 下页信息
        /// </summary>
        public Paging paging { get; set; }


        public class Orders
        {
            public string RowId { get; set; }
            /// <summary>
            /// ID	
            /// </summary>
            public string ID_ { get; set; }
            /// <summary>
            /// id	
            /// </summary>
            public string id { get; set; }

            /// <summary>
            /// 产品类型	
            /// </summary>
            public string Type { get; set; }

            /// <summary>
            /// 产品品牌	
            /// </summary>
            public string Brand { get; set; }
            /// <summary>
            /// 店铺ID	
            /// </summary>
            public string SellerId { get; set; }
            /// <summary>
            /// 发货类型	
            /// </summary>
            public string ShipmentType { get; set; }
            /// <summary>
            /// 单据状态	
            /// </summary>
            public string status_;
            public string status
            {
                get { return status_; }
                set
                {
                    if (value == "PLACING") status_ = "预订处理中";
                    else if (value == "RESERVED") status_ = "保留";
                    else if (value == "UNPAID") status_ = "已发货未付款";
                    else if (value == "PROCESSING") status_ = "处理中";
                    else if (value == "DELIVERY") status_ = "配送中";
                    else if (value == "PICKUP") status_ = "配送中";
                    else if (value == "DELIVERED") status_ = "已收货";
                    else if (value == "CANCELLED") status_ = "已取消";
                    else if (value == "PENDING") status_ = "等待卖家处理";
                    else if (value == "PARTIALLY_RETURNED") status_ = "部分退货";
                    else if (value == "RETURNED") status_ = "全部退货";
                    else if (value == "UNKNOWN") status_ = "未知";
                    else status_ = value;

                }


            }
            /// <summary>
            /// 子状态	
            /// </summary>
            public string substatus { get; set; }
            /// <summary>
            /// 创建日期	
            /// </summary>
            public string creationDate { get; set; }
            /// <summary>
            /// 更新日期	
            /// </summary>
            public string updatedAt { get; set; }
            /// <summary>
            /// 币别	
            /// </summary>
            public string currency { get; set; }
            /// <summary>
            /// 付款金额
            /// </summary>
            public string itemsTotal { get; set; }
            /// <summary>
            /// 交货总计	
            /// </summary>
            public string deliveryTotal { get; set; }
            /// <summary>
            /// 订单中所有商品的费用均以买家的货币为单位，扣除折扣后不包括运费	
            /// </summary>
            //public string buyerItemsTotal { get; set; }
            /// <summary>
            /// 订单中所有商品的价格（以买家的货币为单位）扣除折扣并考虑运费。	
            /// </summary>
            //public string buyerTotal { get; set; }
            /// <summary>
            /// 订单中所有商品在应用折扣之前（以买家货币为单位）的成本，包括运费	
            /// </summary>
            public string buyerItemsTotalBeforeDiscount { get; set; }
            /// <summary>
            /// 产品价格(不包括运费，折扣)	
            /// </summary>
            public string buyerTotalBeforeDiscount { get; set; }
            /// <summary>
            /// 付款类型	
            /// </summary>
            public string paymentType_;
            public string paymentType
            {
                get { return paymentType_; }

                set
                {
                    if (value == "PREPAID") paymentType_ = "结帐付款";
                    else if (value == "POSTPAID") paymentType_ = "货到付款";
                    else if (value == "UNKNOWN") paymentType_ = "未知";
                    else paymentType_ = value;
                }


            }
            /// <summary>
            /// 付款方式	
            /// </summary>
            public string paymentMethod { get; set; }
            /// <summary>
            /// 真实订单	
            /// </summary>
            public string fake { get; set; }
            /// <summary>
            /// 税制	
            /// </summary>
            public string taxSystem { get; set; }
            /// <summary>
            /// 请求取消	
            /// </summary>
            public string cancelRequested { get; set; }



            /// <summary>
            /// id	
            /// </summary>
            public List<Items> items { get; set; }
            /// <summary>
            /// MSKU
            /// </summary>
            public string offerId { get; set; }
            /// <summary>
            /// 产品名称
            /// </summary>
            public string offerName { get; set; }
            /// <summary>
            /// 产品价格
            /// </summary>
            public string price { get; set; }
            /// <summary>
            /// 买家价格
            /// </summary>
            public string buyerPrice { get; set; }
            /// <summary>
            /// 买家价格前折扣
            /// </summary>
            public string buyerPriceBeforeDiscount { get; set; }
            /// <summary>
            /// 折扣前价格
            /// </summary>
            public string priceBeforeDiscount { get; set; }

            /// <summary>
            /// 广告费
            /// </summary>
            public string promosSubsidy { get; set; }
            /// <summary>
            /// 数量
            /// </summary>
            public string count { get; set; }
            /// <summary>
            /// 增值税
            /// </summary>
            public string vat { get; set; }
            /// <summary>
            /// 商品编码
            /// </summary>
            public string shopSku { get; set; }
            /// <summary>
            /// 费用合计
            /// </summary>
            public string subsidy { get; set; }
            /// <summary>
            /// 合作伙伴仓库ID
            /// </summary>
            public string partnerWarehouseId { get; set; }
            public class Items
            {
                /// <summary>
                /// id
                /// </summary>
                public string id { get; set; }
                /// <summary>
                /// MSKU
                /// </summary>
                public string offerId { get; set; }
                /// <summary>
                /// 产品名称
                /// </summary>
                public string offerName { get; set; }
                /// <summary>
                /// 产品价格
                /// </summary>
                public string price { get; set; }
                /// <summary>
                /// 买家价格
                /// </summary>
                public string buyerPrice { get; set; }
                /// <summary>
                /// 买家价格前折扣
                /// </summary>
                public string buyerPriceBeforeDiscount { get; set; }
                /// <summary>
                /// 折扣前价格
                /// </summary>
                public string priceBeforeDiscount { get; set; }
                /// <summary>
                /// 数量
                /// </summary>
                public string count { get; set; }
                /// <summary>
                /// 增值税
                /// </summary>
                public string vat { get; set; }
                /// <summary>
                /// 商品编码
                /// </summary>
                public string shopSku { get; set; }
                /// <summary>
                /// 费用合计
                /// </summary>
                public string subsidy { get; set; }
                /// <summary>
                /// 合作伙伴仓库ID
                /// </summary>
                public string partnerWarehouseId { get; set; }

                /// <summary>
                /// 广告费
                /// </summary>
                public List<Promos> promos { get; set; }

               

                public class Promos
                {
                    /// <summary>
                    /// 广告类型
                    /// </summary>
                    public string type { get; set; }
                    /// <summary>
                    /// 费用金额
                    /// </summary>
                    public string subsidy { get; set; }
                }
                /// <summary>
                /// 商品费用
                /// </summary>
                public List<Subsidies> subsidies { get; set; }


            }




            /// <summary>
            /// 订单费用
            /// </summary>
            public List<Subsidies> subsidies { get; set; }
            public class Subsidies
            {
                /// <summary>
                /// 费用类型
                /// </summary>
                public string type { get; set; }
                /// <summary>
                /// 费用金额
                /// </summary>
                public string amount { get; set; }
            }


            /// <summary>
            /// 交货信息
            /// </summary>
            public Delivery delivery { get; set; }


            /// <summary>
            /// 订单配送方式
            /// </summary>
            public string delivery_type { get; set; }
            /// <summary>
            /// 送货服务名称
            /// </summary>
            public string delivery_serviceName { get; set; }
            /// <summary>
            /// 运费
            /// </summary>
            public string delivery_price { get; set; }
            /// <summary>
            /// 交付合作伙伴类型
            /// </summary>
            public string delivery_deliveryPartnerType { get; set; }
            /// <summary>
            /// 配送服务ID
            /// </summary>
            public string delivery_ServiceId { get; set; }
            /// <summary>
            /// 调整价格
            /// </summary>
            public string delivery_liftPrice { get; set; }
            /// <summary>
            /// 提货点代码
            /// </summary>
            public string delivery_outletCode { get; set; }
            /// <summary>
            /// 税制
            /// </summary>
            public string delivery_taxSystem { get; set; }

            /// <summary>
            /// 是否取消
            /// </summary>
            public string delivery_cancelRequested { get; set; }
            /// <summary>
            /// 交货日期
            /// </summary>
            public string date { get; set; }

            /// <summary>
            /// 区域名称
            /// </summary>
            public string region_name { get; set; }
            /// <summary>
            /// 区域类型
            /// </summary>
            public string region_type { get; set; }

            /// <summary>
            /// 国家
            /// </summary>
            public string address_country { get; set; }
            /// <summary>
            /// 邮编
            /// </summary>
            public string address_postcode { get; set; }
            /// <summary>
            /// 城市
            /// </summary>
            public string address_city { get; set; }
            /// <summary>
            /// 街道
            /// </summary>
            public string address_street { get; set; }
            /// <summary>
            /// 房号
            /// </summary>
            public string address_house { get; set; }
            /// <summary>
            /// 发货日期
            /// </summary>
            public string shipments_shipmentDate { get; set; }
            /// <summary>
            /// 买家类型
            /// </summary>
            public string buyer_type { get; set; }
            public class Delivery
            {
                /// <summary>
                /// 订单配送方式
                /// </summary>
                public string type { get; set; }
                /// <summary>
                /// 送货服务名称
                /// </summary>
                public string serviceName { get; set; }
                /// <summary>
                /// 运费
                /// </summary>
                public string price { get; set; }
                /// <summary>
                /// 交付合作伙伴类型
                /// </summary>
                public string deliveryPartnerType { get; set; }
                /// <summary>
                /// 交货日期
                /// </summary>
                public Dates dates { get; set; }


                public class Dates
                {
                    /// <summary>
                    /// 交货日期
                    /// </summary>
                    public string fromDate { get; set; }
                    /// <summary>
                    /// 交货日期
                    /// </summary>
                    public string toDate { get; set; }
                    /// <summary>
                    /// 交货时间
                    /// </summary>
                    public string fromTime { get; set; }
                    /// <summary>
                    /// 交货时间
                    /// </summary>
                    public string toTime { get; set; }
                }

                /// <summary>
                /// 配送区域
                /// </summary>
                public Region region { get; set; }


                public class Region
                {
                    /// <summary>
                    /// id
                    /// </summary>
                    public string id { get; set; }
                    /// <summary>
                    /// 区域名称
                    /// </summary>
                    public string name { get; set; }
                    /// <summary>
                    /// 区域类型
                    /// </summary>
                    public string type { get; set; }
                    /// <summary>
                    /// id
                    /// </summary>
                    public Parent parent { get; set; }

                    public class Parent
                    {
                        /// <summary>
                        /// id
                        /// </summary>
                        public string id { get; set; }
                        /// <summary>
                        /// id
                        /// </summary>
                        public string name { get; set; }
                        /// <summary>
                        /// id
                        /// </summary>
                        public string type { get; set; }
                        /// <summary>
                        /// id
                        /// </summary>
                        public Parent parent { get; set; }
                    }
                }



                /// <summary>
                /// 地址信息
                /// </summary>
                public Address address { get; set; }


                public class Address
                {
                    /// <summary>
                    /// 国家
                    /// </summary>
                    public string country { get; set; }
                    /// <summary>
                    /// 邮编
                    /// </summary>
                    public string postcode { get; set; }
                    /// <summary>
                    /// 城市
                    /// </summary>
                    public string city { get; set; }
                    /// <summary>
                    /// 街道
                    /// </summary>
                    public string street { get; set; }
                    /// <summary>
                    /// 房号
                    /// </summary>
                    public string house { get; set; }

                }

                /// <summary>
                /// 配送服务ID
                /// </summary>
                public string deliveryServiceId { get; set; }
                /// <summary>
                /// 调整价格
                /// </summary>
                public string liftPrice { get; set; }
                /// <summary>
                /// 提货点代码
                /// </summary>
                public string outletCode { get; set; }


                /// <summary>
                /// 发货信息
                /// </summary>
                public List<Shipments> shipments { get; set; }

                public class Shipments
                {
                    /// <summary>
                    /// 包裹ID
                    /// </summary>
                    public string id { get; set; }
                    /// <summary>
                    /// 发货日期
                    /// </summary>
                    public string shipmentDate { get; set; }

                    /// <summary>
                    /// 货件信息
                    /// </summary>
                    public List<Boxes> boxes { get; set; }
                    public class Boxes
                    {
                        /// <summary>
                        /// 货件ID
                        /// </summary>
                        public string id { get; set; }
                        /// <summary>
                        /// 货件编号
                        /// </summary>
                        public string fulfilmentId { get; set; }

                    }
                }

                /// <summary>
                /// 买家信息
                /// </summary>
                public Buyer buyer { get; set; }

                public class Buyer
                {
                    /// <summary>
                    /// 买家类型
                    /// </summary>
                    public string type { get; set; }

                }

                /// <summary>
                /// 税制
                /// </summary>
                public string taxSystem { get; set; }

                /// <summary>
                /// 是否取消
                /// </summary>
                public string cancelRequested { get; set; }
            }


        }


        public class Paging
        {
            /// <summary>
            /// 下页索引
            /// </summary>
            public string nextPageToken { get; set; }

        }


    }
}
